package com.dalongxin.work.data;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 付款申请Bean
 */
public class Pay implements Serializable {

    private int id;
    private int companyId;
    private String companyName;
    private int projectId;
    private String projectName;
    private String fillDate;
    private int applyUserId;
    private String applyUserName;
    private int departmentId;
    private String departmentName;
    private double totalFee;
    private String upperCaseFee;
    private String reason;
    private String receiveCompany;
    private String receiveBank;
    private String receiveAccount;
    private String contactUserName;
    private String contactUserPhone;
    private String remark;
    private int approveId1;
    private String approveName1;
    private int approveId2;
    private String approveName2;
    private int approveId3;
    private String approveName3;
    private int status;
    private int createId;
    private String createName;
    private String createTime;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getCompanyId() {
        return companyId;
    }

    public void setCompanyId(int companyId) {
        this.companyId = companyId;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public int getProjectId() {
        return projectId;
    }

    public void setProjectId(int projectId) {
        this.projectId = projectId;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getFillDate() {
        return fillDate;
    }

    public void setFillDate(String fillDate) {
        this.fillDate = fillDate;
    }

    public int getApplyUserId() {
        return applyUserId;
    }

    public void setApplyUserId(int applyUserId) {
        this.applyUserId = applyUserId;
    }

    public String getApplyUserName() {
        return applyUserName;
    }

    public void setApplyUserName(String applyUserName) {
        this.applyUserName = applyUserName;
    }

    public int getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(int departmentId) {
        this.departmentId = departmentId;
    }

    public String getDepartmentName() {
        return departmentName;
    }

    public void setDepartmentName(String departmentName) {
        this.departmentName = departmentName;
    }

    public double getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(double totalFee) {
        this.totalFee = totalFee;
    }

    public String getUpperCaseFee() {
        return upperCaseFee;
    }

    public void setUpperCaseFee(String upperCaseFee) {
        this.upperCaseFee = upperCaseFee;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public String getReceiveCompany() {
        return receiveCompany;
    }

    public void setReceiveCompany(String receiveCompany) {
        this.receiveCompany = receiveCompany;
    }

    public String getReceiveBank() {
        return receiveBank;
    }

    public void setReceiveBank(String receiveBank) {
        this.receiveBank = receiveBank;
    }

    public String getReceiveAccount() {
        return receiveAccount;
    }

    public void setReceiveAccount(String receiveAccount) {
        this.receiveAccount = receiveAccount;
    }

    public String getContactUserName() {
        return contactUserName;
    }

    public void setContactUserName(String contactUserName) {
        this.contactUserName = contactUserName;
    }

    public String getContactUserPhone() {
        return contactUserPhone;
    }

    public void setContactUserPhone(String contactUserPhone) {
        this.contactUserPhone = contactUserPhone;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public int getApproveId1() {
        return approveId1;
    }

    public void setApproveId1(int approveId1) {
        this.approveId1 = approveId1;
    }

    public String getApproveName1() {
        return approveName1;
    }

    public void setApproveName1(String approveName1) {
        this.approveName1 = approveName1;
    }

    public int getApproveId2() {
        return approveId2;
    }

    public void setApproveId2(int approveId2) {
        this.approveId2 = approveId2;
    }

    public String getApproveName2() {
        return approveName2;
    }

    public void setApproveName2(String approveName2) {
        this.approveName2 = approveName2;
    }

    public int getApproveId3() {
        return approveId3;
    }

    public void setApproveId3(int approveId3) {
        this.approveId3 = approveId3;
    }

    public String getApproveName3() {
        return approveName3;
    }

    public void setApproveName3(String approveName3) {
        this.approveName3 = approveName3;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getCreateId() {
        return createId;
    }

    public void setCreateId(int createId) {
        this.createId = createId;
    }

    public String getCreateName() {
        return createName;
    }

    public void setCreateName(String createName) {
        this.createName = createName;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public static Pay parseFromJson(JSONObject jsonObject) {
        Pay pay = new Pay();
        pay.id = jsonObject.optInt("id");
        pay.companyId = jsonObject.optInt("companyId");
        pay.companyName = jsonObject.optString("companyName");
        pay.projectId = jsonObject.optInt("projectId");
        pay.projectName = jsonObject.optString("projectName");
        pay.fillDate = jsonObject.optString("fillDate");
        pay.applyUserId = jsonObject.optInt("applyUserId");
        pay.applyUserName = jsonObject.optString("applyUserName");
        pay.departmentId = jsonObject.optInt("departmentId");
        pay.departmentName = jsonObject.optString("departmentName");
        pay.totalFee = jsonObject.optDouble("totalFee");
        pay.upperCaseFee = jsonObject.optString("upperCaseFee");
        pay.reason = jsonObject.optString("reason");
        pay.receiveCompany = jsonObject.optString("receiveCompany");
        pay.receiveBank = jsonObject.optString("receiveBank");
        pay.receiveAccount = jsonObject.optString("receiveAccount");
        pay.contactUserName = jsonObject.optString("contactUserName");
        pay.contactUserPhone = jsonObject.optString("contactUserPhone");
        pay.remark = jsonObject.optString("remark");
        pay.approveId1 = jsonObject.optInt("approveId1");
        pay.approveName1 = jsonObject.optString("approveName1");
        pay.approveId2 = jsonObject.optInt("approveId2");
        pay.approveName2 = jsonObject.optString("approveName2");
        pay.approveId3 = jsonObject.optInt("approveId3");
        pay.approveName3 = jsonObject.optString("approveName3");
        pay.status = jsonObject.optInt("status");
        pay.createId = jsonObject.optInt("createId");
        pay.createName = jsonObject.optString("createName");
        pay.createTime = jsonObject.optString("createTime");
        return pay;
    }

    public static List<Pay> parseFromJsonList(JSONArray jsonArray) {
        List<Pay> list = new ArrayList<>();
        if(jsonArray != null && jsonArray.length() > 0) {
            for(int i=0;i<jsonArray.length();i++) {
                Pay item = parseFromJson(jsonArray.optJSONObject(i));
                if(item != null)list.add(item);
            }
        }
        return list;
    }
}
